#pragma once

typedef char* MimeEntry[2];

#define MAX_MIME_TABLE 100

namespace pugi
{
	class xml_node;
}

struct Performance
{
	Performance()
		:iocpHandlers(2)
	{

	}
	size_t iocpHandlers;
};

class HttpLocationConfig
{
public:
	char* m_root;
	char* m_url;
	char* host;
	bool isProxy;
};

#define HTTP_MAX_LOCATIONS 256

class HttpConfig
{
	
public:
	HttpConfig(void);
	~HttpConfig(void);
	bool ReadConfig(const _TCHAR* filename);
private:
	bool ReadMimeTypes(const pugi::xml_node* node);
	bool ReadPerformance(const pugi::xml_node* node);
	void Clear(void);
	bool ReadServer( const pugi::xml_node* node );
	bool ReadLocation( pugi::xml_node* node );
	bool ReadProxy( pugi::xml_node* node );

	HttpLocationConfig * CurrentLocation();

public:
	MimeEntry m_mimeTable[MAX_MIME_TABLE];
	size_t m_mimeTableSize;
	Performance m_performance;
	WORD m_port;
	char* m_root;
	HttpLocationConfig m_location[HTTP_MAX_LOCATIONS];
	unsigned char m_locations;
};

